import { reactive, ref, Ref } from "vue"
import { ElFormType, FormDataType } from "../type"

function useState() {
  const formData: FormDataType = reactive({
    account: "",
    password: "",
  })
  const btnLoading = ref(false)
  const formRef = ref<ElFormType>() as Ref<ElFormType>
  const formRules = {
    account: [{ required: true, message: "请输入账号", trigger: "blur" }],
    password: [{ required: true, message: "请输入密码", trigger: "blur" }],
  }
  return { formData, btnLoading, formRef, formRules }
}
export default useState
